package com.dingwen.treasure.model.entity.mybatisplus;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * 用户角色关系表
 *
 * @author dingwen
 * @TableName sys_user_role
 * @date 2022/06/20
 */
@TableName(value = "sys_user_role")
@ApiModel(value = "sysUserRole", description = "用户角色关系表")
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@Data
@EqualsAndHashCode(callSuper = false)
public class SysUserRole extends BaseEntity implements Serializable {
    /**
     * 主键
     */
    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 用户ID
     */
    @ApiModelProperty(value = "用户ID")
    @TableField(value = "user_id")
    private Long userId;

    /**
     * 角色ID
     */
    @ApiModelProperty(value = "角色ID")
    @TableField(value = "role_id")
    private Long roleId;


    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     * toBuilder = true： 可修改
     *
     * @param createTime
     * @param updateTime
     * @param deleted
     * @param version
     * @param createBy
     * @param updateBy
     * @param remark
     */
    @Builder(toBuilder = true)
    public SysUserRole(LocalDateTime createTime, LocalDateTime updateTime, Integer deleted, Integer version, String createBy, String updateBy, String remark, Long id, Long userId, Long roleId) {
        super(createTime, updateTime, deleted, version, createBy, updateBy, remark);
        this.id = id;
        this.userId = userId;
        this.roleId = roleId;
    }
}